FileStorage

interface FileStorage

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Interface defining callbacks for handling events related to FileStorage within the SDK.

Properties

Link copied to clipboard
abstract val externalStorageName: String?

Get the current connected user external storage name if any.

Link copied to clipboard
abstract val externalStorageUrl: String?

Get the current connected user external storage URL if any.

Functions

Link copied to clipboard
abstract fun addViewerToFileDescriptor(fileDescriptor: RainbowFileDescriptor, viewer: RainbowFileViewer, listener: RainbowListener<RainbowFileDescriptor, FileRepository.ViewerError>? = null)

Adds a RainbowFileViewer to a RainbowFileDescriptor The specified viewer will have access to the RainbowFileDescriptor, they will be able to download and view the file.

Link copied to clipboard
abstract fun addViewerToFileDescriptors(fileDescriptors: List<RainbowFileDescriptor>, viewer: RainbowFileViewer, listener: RainbowListener<List<RainbowFileDescriptor>, Map<Int, List<RainbowFileDescriptor>>>? = null)

Adds a RainbowFileViewer to as list of RainbowFileDescriptor

Link copied to clipboard
abstract fun cancelDownload(fileDescriptor: RainbowFileDescriptor): Boolean

Cancel the download started on the RainbowFileDescriptor. If there is a downloaded file, partial or complete, it is deleted.

Link copied to clipboard
abstract fun cancelUpload(fileDescriptor: RainbowFileDescriptor)

Cancel the upload started on the RainbowFileDescriptor.

Link copied to clipboard
abstract fun copyFileDescriptorsToPersonalStorage(fileDescriptors: List<RainbowFileDescriptor>, hidePurpose: Boolean = false, listener: RainbowListener<List<RainbowFileDescriptor>, Map<Int, List<RainbowFileDescriptor>>>? = null)

As a viewer of multiple RainbowFileDescriptors, upload a copy in the user personal storage

Link copied to clipboard
abstract fun copyFileDescriptorToPersonalStorage(fileDescriptor: RainbowFileDescriptor, hidePurpose: Boolean = false, listener: RainbowListener<RainbowFileDescriptor, FileRepository.CopyFileDescriptorError>? = null)

As a viewer of the RainbowFileDescriptor, upload a copy in the user personal storage

Link copied to clipboard
abstract fun createExternalLinkForRoom(roomId: String, listener: RainbowListener<String, Unit>)

Create the external storage URL for accessing shared files within a room. Only Bubble owner can do it.

Link copied to clipboard

Deletes all previously downloaded files on the device

Link copied to clipboard
abstract fun deleteAllFileDescriptors(listener: RainbowListener<Unit, FileRepository.DeleteFileDescriptorError>? = null)

Deletes all RainbowFileDescriptor owned by the user

Link copied to clipboard
abstract fun deleteFileDescriptor(fileDescriptor: RainbowFileDescriptor, listener: RainbowListener<Unit, FileRepository.DeleteFileDescriptorError>? = null)

Deletes the RainbowFileDescriptor from the server

Link copied to clipboard
abstract fun deleteFileDescriptors(fileDescriptors: List<RainbowFileDescriptor>, listener: RainbowListener<Unit, Unit>? = null)

Deletes a list of RainbowFileDescriptor from the server

Link copied to clipboard
abstract fun deleteFileDescriptorsViewer(fileDescriptors: List<RainbowFileDescriptor>, viewerIdToDelete: String, listener: RainbowListener<Unit, FileRepository.ViewerError>?)

Deletes a given viewer from a list of RainbowFileDescriptor

Link copied to clipboard
abstract fun deleteFileDescriptorViewer(fileDescriptor: RainbowFileDescriptor, viewerIdToDelete: String, deleteFileOnLastViewer: Boolean = false, listener: RainbowListener<Unit, FileRepository.ViewerError>? = null)

Deletes a given viewer from a RainbowFileDescriptor The user must be a current viewer of the RainbowFileDescriptor, once deleted, they will no longer have access to it

Link copied to clipboard
abstract fun downloadFile(fileDescriptor: RainbowFileDescriptor, listener: RainbowListener<RainbowFileDescriptor, Unit>? = null)

Download the file from the server. This method uses the Android DownloadManager

Link copied to clipboard
abstract fun fetchFileDescriptorById(fileDescriptorId: String?, listener: RainbowListener<RainbowFileDescriptor, FileRepository.FetchFileDescriptorError>? = null): RainbowFileDescriptor?

Returns a RainbowFileDescriptor and fetch last data from the server

Link copied to clipboard
abstract fun fetchFileInBubble(room: Room, limit: Int, offset: Int, listener: RainbowListener<List<RainbowFileDescriptor>, Unit>? = null)

Fetches a list of RainbowFileDescriptor received in a bubble conversation This method accept a limit and an offset parameters for pagination, when limit is set to 0, the API returns a maximum of 100 results. If offset is greater that the limit of RainbowFileDescriptor received in this bubble, no results are returned.

Link copied to clipboard
abstract fun fetchFileInConversation(conversation: IRainbowConversation, limit: Int, offset: Int, listener: RainbowListener<List<RainbowFileDescriptor>, Unit>? = null)

Fetches a list of RainbowFileDescriptor in a conversation This method accept a limit and an offset parameters for pagination, when limit is set to 0, the API returns a maximum of 100 results. If offset is greater that the limit of RainbowFileDescriptor in this conversation, no results are returned.

Link copied to clipboard
abstract fun fetchFileReceived(limit: Int, offset: Int, listener: RainbowListener<List<RainbowFileDescriptor>, Unit>? = null)

Fetches a list of received RainbowFileDescriptor This method accept a limit and an offset parameters for pagination, when limit is set to 0, the API returns a maximum of 100 results. If offset is greater that the limit of received RainbowFileDescriptor, no results are returned. This method does not filters results.

Link copied to clipboard
abstract fun fetchFileReceivedInBubble(room: Room, limit: Int, offset: Int, listener: RainbowListener<List<RainbowFileDescriptor>, Unit>? = null)

Fetches a list of RainbowFileDescriptor received in a bubble conversation This method accept a limit and an offset parameters for pagination, when limit is set to 0, the API returns a maximum of 100 results. If offset is greater that the limit of RainbowFileDescriptor received in this bubble, no results are returned.

Link copied to clipboard
abstract fun fetchFileReceivedInConversation(conversation: IRainbowConversation, limit: Int, offset: Int, listener: RainbowListener<List<RainbowFileDescriptor>, Unit>? = null)

Fetches a list of RainbowFileDescriptor received in a conversation This method accept a limit and an offset parameters for pagination, when limit is set to 0, the API returns a maximum of 100 results. If offset is greater that the limit of RainbowFileDescriptor received in this conversation, no results are returned.

Link copied to clipboard
abstract fun fetchFileSent(limit: Int, offset: Int, listener: RainbowListener<List<RainbowFileDescriptor>, Unit>? = null)

Fetches a list of sent RainbowFileDescriptor This method accept a limit and an offset parameters for pagination, when limit is set to 0, the API returns a maximum of 100 results. If offset is greater that the limit of sent RainbowFileDescriptor, no results are returned. This method does not filters results.

Link copied to clipboard
abstract fun fetchFileSentInBubble(room: Room, limit: Int, offset: Int, listener: RainbowListener<List<RainbowFileDescriptor>, Unit>? = null)

Fetches a list of RainbowFileDescriptor in a bubble conversation This method accept a limit and an offset parameters for pagination, when limit is set to 0, the API returns a maximum of 100 results. If offset is greater that the limit of RainbowFileDescriptor in this bubble, no results are returned.

Link copied to clipboard
abstract fun fetchFileSentInConversation(conversation: IRainbowConversation, limit: Int, offset: Int, listener: RainbowListener<List<RainbowFileDescriptor>, Unit>? = null)

Fetches a list of RainbowFileDescriptor sent in a conversation This method accept a limit and an offset parameters for pagination, when limit is set to 0, the API returns a maximum of 100 results. If offset is greater that the limit of RainbowFileDescriptor sent in this conversation, no results are returned.

Link copied to clipboard
abstract fun fileOwnershipChange(fileDescriptor: RainbowFileDescriptor, ownerId: String, listener: RainbowListener<RainbowFileDescriptor, FileRepository.ChangeOwnershipError>? = null)

Drops the ownership to another Rainbow user of the same company The user must be in the same company and allowed by administrator

Link copied to clipboard
abstract fun getCurrentUploadsByIdentifier(identifier: String): List<RainbowFileDescriptor>

Retrieve the current uploads if there are any

Link copied to clipboard
abstract fun getExternalLinkForRoom(roomId: String, listener: RainbowListener<String, Unit>)

Get the external storage URL for accessing shared files within a room.

Link copied to clipboard
abstract fun getExternalLoginUrl(callback: String, listener: RainbowListener<String, Unit>)

Retrieves the external storage login URL associated to the connected user.

Link copied to clipboard
abstract fun getFileDescriptorById(fileDescriptorId: String): RainbowFileDescriptor?

Returns a RainbowFileDescriptor if found in local list

Link copied to clipboard
abstract fun getFileDownloaded(fileDescriptor: RainbowFileDescriptor): File?

Retrieves the downloaded file associated to the RainbowFileDescriptor from the device

Link copied to clipboard
abstract fun getUserQuotaConsumption(listener: RainbowListener<Consumption, Unit>? = null): Consumption?

Retrieves the current file storage consumption and quota associated to the connected user.

Link copied to clipboard
abstract fun isDownloaded(fileDescriptor: RainbowFileDescriptor): Boolean

Checks if the file has already been downloaded to the device

Link copied to clipboard

Register to the listener with following triggers: onMaxQuotaReached

Link copied to clipboard

Unregister to the listener with following triggers: onMaxQuotaReached

Link copied to clipboard
abstract fun uploadFiles(fileDescriptors: List<RainbowFileDescriptor>, viewer: RainbowFileViewer? = null, identifier: String? = null, resolution: Int? = HIGH_RESOLUTION, listener: RainbowListener<List<RainbowFileDescriptor>, Map<Int, List<RainbowFileDescriptor>>>? = null)

Upload a list of files with a specific RainbowFileViewer

Link copied to clipboard
abstract fun uploadFileToBubble(room: Room, uriFile: Uri, listener: RainbowListener<RainbowFileDescriptor, Unit>? = null)

Uploads a file to a bubble A new RainbowFileDescriptor will be create with the user as the owner, the bubble will be a viewer for this RainbowFileDescriptor.

Link copied to clipboard
abstract fun uploadFileToChannel(channel: Channel, uriFile: Uri, listener: RainbowListener<RainbowFileDescriptor, Unit>? = null)

Uploads a file to a channel A new RainbowFileDescriptor will be create with the user as the owner, the channel will be a viewer for this RainbowFileDescriptor.

Link copied to clipboard
abstract fun uploadFileToConversation(conversation: IRainbowConversation, uriFile: Uri, listener: RainbowListener<RainbowFileDescriptor, Unit>? = null)

Uploads a file to a conversation A new RainbowFileDescriptor will be create with the user as the owner, the IRainbowConversation will be a viewer for this RainbowFileDescriptor whether it's a contact or a bubble.

Link copied to clipboard
abstract fun uploadFileToPersonalStorage(uriFile: Uri, listener: RainbowListener<RainbowFileDescriptor, Unit>? = null)

Uploads a file to the user personal storage